Add calculated fields
This topic demonstrates how to add a calculated field to a report. The main purpose of calculated fields is to perform pre-calculations (of virtually any level of complexity) over data fields. To learn how to easily perform simple calculations within a single data field, see Add totals to a report.
In the Report Designer, a calculated field is similar to an ordinary data field (e.g. you can bind controls to it, and group, sort and filter your report against it).
To add a calculated field to a report, follow the instructions below.
- To create a calculated field, in the Field List, right-click on any data member, and in the menu choose Add Calculated Field.
- In the Field List, select the created field to show its properties in the Property Grid. Among these options, make sure to change the Field Type property to an appropriate value.
-
Now, let's create an expression for the calculated field. Click on the ellipsis button in the Expression section to open the Expression Editor. You can also open this dialog by right-clicking on your calculated field within the Field List and selecting Edit Expression.
Click on Fields to see the field list. Double-click on field names to add them to the expression string. Use the toolbar to add operators between field names.
Note: It is also possible to employ parameters in a calculated field's expression.
To close the dialog and save the expression, click OK.
- Finally, drag the calculated field from the Field List onto the required band, just like an ordinary data field.
The report with a calculated field is now ready. Switch to the Preview tab to view the result.